<?php
/**
 * Created by PhpStorm.
 * User: W
 * Date: 2018/12/24
 * Time: 8:53
 */

namespace app\sports_admin\service;
use app\sports_admin\model\DataBook;
use think\db;
use think\Request;
class Book
{
    //删除图书
    public static function del()
    {
        $data = Request::instance()->only('id');
        return DataBook::where("id",$data['id'])->delete();
    }
    //图书信息
    public static function content($id)
    {
        return DataBook::content($id);
    }
    //编辑图书信息
    public static function update()
    {
        $data = Request::instance()->only("id,catid,title,creator,publisher,date,pressyear,identifier,thumb,url");
        return DataBook::where('id',$data['id'])
            ->update(["catid"=>$data['catid'],
                "title"=>$data['title'],
                "creator"=>$data['creator'],
                "publisher"=>$data['publisher'],
                "date"=>$data['date'],
                "pressyear"=>$data['pressyear'],
                "identifier"=>$data['identifier'],
                "thumb"=>$data['thumb'],
                "url"=>$data['thumb']]);
    }
}